from DIDsocket import DIDSocket

def client_example(own_did, target_did, host, port):
    """客户端使用示例"""
    did_socket = DIDSocket(own_did)
    connection = did_socket.connect(target_did, port, host)

    if connection:
        # 发送数据
        did_socket.send(connection, "Hello from client!")

        # 接收回复
        response = did_socket.recv(connection)
        if response:
            print(f"收到回复: {response}")

        # 关闭连接
        did_socket.close_connection(connection)
        did_socket.close()


did="did:p2p_did_chat:g05JbAygra"
ip="10.70.88.94"
port=456
client_example(did,did,ip,port)